package com.chain.BrotherExchange.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.chain.BrotherExchange.R;
import com.chain.BrotherExchange.ui.core.BaseActivity;
import com.chain.BrotherExchange.utils.ActivityBarHelper;
import com.chain.BrotherExchange.utils.Androids;

import butterknife.Bind;

/**
 * 安全中心
 */
public class SecurityCenterActivity extends BaseActivity {

    @Bind(R.id.transaction_text) TextView mTransactionText;
    @Bind(R.id.phone_setting_layout) View mPhoneSettingLayout;
    @Bind(R.id.login_password_layout) View mLoginPasswordLayout;
    @Bind(R.id.transaction_password_layout) View mTransactionPasswordLayout;

    public static void launch(Context context) {
        context.startActivity(new Intent(context, SecurityCenterActivity.class));
    }

    @Override
    protected int getLayoutID() {
        return R.layout.activity_security_center;
    }

    @Override
    protected void initActions() {
        ActivityBarHelper.init(this, R.string.title_security_center);

        // 修改手机号码
        mPhoneSettingLayout.setOnClickListener(v ->
                MobilePhoneSettingActivity.launch(v.getContext()));

        // 修改登录密码
        mLoginPasswordLayout.setOnClickListener(v ->
                ModifyLoginPasswordActivity.launch(v.getContext()));

        // 修改交易密码
        mTransactionText.setText(Androids.LocalConfig.isSetTransactionPassword()
                ? R.string.modify : R.string.setting);
        mTransactionPasswordLayout.setOnClickListener(v ->
                SettingTransactionPasswordActivity.launch(v.getContext()));
    }
}
